{% extends "meetings/base_rooms_times.html" %}
{% load django_bootstrap5 %}

{% block subsection %}

    <div class="module role-container">
        <h2>Rooms</h2>

        <div class="inline-group">
            <div class="tabular inline-related">
                 <!-- [html-validate-disable-block wcag/h32 -- FIXME: no submit button] -->
                <form id="meetings-meta-rooms" method="post">{% csrf_token %}
                    {{ formset.management_form }}
                    {{ formset.non_form_errors }}
                    {% if options_form %}{{ options_form.errors }}{% endif %}

                    <table id="id_rooms_table" class="full-width">
                        <thead>
                            <tr>
                                <th scope="col"></th>
                                {% for field in formset.forms.0.visible_fields %}
                                    <th scope="col">{{ field.label|capfirst }}</th>
                                {% endfor %}
                            </tr>
                        </thead>
                        <tbody>
                            {% for form in formset.forms %}
                                {% if form.non_field_errors %}
                                    <tr><td colspan="3">{{ form.non_field_errors }}</td></tr>
                                {% endif %}
                                <tr class="dynamic-inline {% cycle 'row1' 'row2' %}">
                                    <td>
                                    {% for hidden in form.hidden_fields %}
                                        {{ hidden }}
                                    {% endfor %}
                                    </td>
                                    {% for field in form.visible_fields %}
                                        <td>
                                            {{ field.errors }}
                                            {{ field }}
                                        </td>
                                    {% endfor %}
                                </tr>
                            {% endfor %}
            {% if options_form %}<tr><td colspan="11">{{ options_form.as_p }}</td></tr>{% endif %}
                        </tbody>
                    </table>
                </form>
            </div>
        </div>
        <div class="button-group">
            <ul>
                <li>
                    <button type="submit"
                            form="meetings-meta-rooms"
                            name="submit"
                            value="Save">
                        Save
                    </button>
                </li>
            </ul>
        </div> <!-- button-group -->
    </div>

{% endblock %}